package service.impl;

import DAO.SubCategoryDao;
import bean.SubCategory;
import service.SubCategoryService;
import java.util.List;

public class SubCategoryServiceImpl implements SubCategoryService {
    private final SubCategoryDao subCategoryDao;

    public SubCategoryServiceImpl(SubCategoryDao subCategoryDao) {
        this.subCategoryDao = subCategoryDao;
    }

    @Override
    public List<SubCategory> getAllSubCategories() {
        return subCategoryDao.getAllSubCategories();
    }

    @Override
    public List<SubCategory> getSubCategoriesByCategoryId(Integer categoryId) {
        return subCategoryDao.getSubCategoriesByCategoryId(categoryId);
    }

    @Override
    public SubCategory getSubCategoryById(int id) {
        return subCategoryDao.getSubCategoryById(id);
    }

    @Override
    public int addSubCategory(SubCategory subCategory) {
        return subCategoryDao.addSubCategory(subCategory);
    }

    @Override
    public int deleteSubCategory(Integer id) {
        return subCategoryDao.deleteSubCategory(id);
    }

    @Override
    public int addSubCategoryTelevisionRelation(int subCategoryId, int televisionId) {
        return subCategoryDao.addSubCategoryTelevisionRelation(subCategoryId, televisionId);
    }

    @Override
    public void addSubCategory(String name, int categoryId) {
        subCategoryDao.addSubCategory(name, categoryId);
    }

    @Override
    public void updateSubCategory(int id, String newName) {
        subCategoryDao.updateSubCategory(id, newName);
    }

    @Override
    public boolean updateSubCategory(SubCategory subCategory) {
        return subCategoryDao.updateSubCategory(subCategory);
    }
} 